import { http } from "@/utils/http";

export type commonResult<T> = {
  code: number;
  msg: string;
  result: T;
};

export type infoType = {

	id?: number,
	projectName?: string,
	modelName?: string,
	deviceId?: string,
	flowCardNum?: string,
	ICCID?: string,
	status?: string,
	operator?: string,
	lastFlow?: string,
	activeDate?: string,
}
export type infoTypeList = {
  data: infoType[];
  total: number;
};

const List = '/business/device/flowcard/v2/flowcards';
const Url = '/business/device/flowcard/v2/flowcard';
export const getList = (params?: object) => {
  return http.request<commonResult<infoTypeList>>("get", List, {
    params
  });
};
export const getInfo = (params?: object) => {
  return http.request<commonResult<infoType>>("get", Url, {
    params
  });
};
export const addInfo = (data?: object) => {
  return http.request<commonResult<any>>("post", Url, {
    data
  });
};
export const editInfo = (data?: object) => {
  return http.request<commonResult<any>>("put", Url, {
    data
  });
};
export const deleteInfo = (data?: object) => {
  return http.request<commonResult<any>>("delete", Url, {
    data
  });
};
/**
 * 2.8.4.2导出全部
 * 
 */

export const importAllflowcard = (params?: object) => {
  return http.request<Blob>("get", '/business/device/flowcard/v2/export', {
    params,
     responseType: 'blob'
  });
};